package com.mms.action.department;

import java.util.List;

import com.mms.dao.DepartmentManagementDao;
import com.mms.entity.Department;
import com.opensymphony.xwork2.Action;

public class AddDepartmentAction implements Action{
	
	private int startPage;
	private String deName;
	private boolean addisSuccess;
	private List<Department> departmentMes;
	private int account;
	
	

	public int getStartPage() {
		return startPage;
	}



	public void setStartPage(int startPage) {
		this.startPage = startPage;
	}



	public String getDeName() {
		return deName;
	}



	public void setDeName(String deName) {
		this.deName = deName;
	}


	public boolean isAddisSuccess() {
		return addisSuccess;
	}



	public void setAddisSuccess(boolean addisSuccess) {
		this.addisSuccess = addisSuccess;
	}



	public List<Department> getDepartmentMes() {
		return departmentMes;
	}



	public void setDepartmentMes(List<Department> departmentMes) {
		this.departmentMes = departmentMes;
	}



	public int getAccount() {
		return account;
	}



	public void setAccount(int account) {
		this.account = account;
	}



	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		DepartmentManagementDao dmd = new DepartmentManagementDao();
		Department department = new Department();
		department.setDeName(deName);
		if(dmd.AddDepartment(department)){
			addisSuccess = true;
		}
		else {
			addisSuccess = false;
		}
		departmentMes = dmd.getDepCount(startPage);
		account = dmd.getcount();
		return "success";
	}
}
